home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class PrintWriter extends Writer {
- private Writer out;
- private boolean autoFlush;
- private boolean trouble;
- private String lineSeparator;
-
- public PrintWriter(OutputStream out) {
- this(out, false);
- }
-
- public PrintWriter(OutputStream out, boolean autoFlush) {
- this((Writer)(new BufferedWriter(new OutputStreamWriter(out))), autoFlush);
- }
-
- public PrintWriter(Writer out) {
- this(out, false);
- }
-
- public PrintWriter(Writer out, boolean autoFlush) {
- super(out);
- this.autoFlush = false;
- this.trouble = false;
- this.out = out;
- this.autoFlush = autoFlush;
- this.lineSeparator = System.getProperty("line.separator");
- }
-
- public boolean checkError() {
- if (this.out != null) {
- this.flush();
- }
-
- return this.trouble;
- }
-
- public void close() {
- try {
- synchronized(super.lock) {
- if (this.out == null) {
- return;
- }
-
- this.out.close();
- this.out = null;
- }
- } catch (IOException var3) {
- this.trouble = true;
- }
-
- }
-
- private void ensureOpen() throws IOException {
- if (this.out == null) {
- throw new IOException("Stream closed");
- }
- }
-
- public void flush() {
- try {
- synchronized(super.lock){}
-
- try {
- this.ensureOpen();
- this.out.flush();
- } catch (Throwable var4) {
- throw var4;
- }
- } catch (IOException var5) {
- this.trouble = true;
- }
-
- }
-
- private void newLine() {
- try {
- synchronized(super.lock){}
-
- try {
- this.ensureOpen();
- this.out.write(this.lineSeparator);
- if (this.autoFlush) {
- this.out.flush();
- }
- } catch (Throwable var5) {
- throw var5;
- }
- } catch (InterruptedIOException var6) {
- Thread.currentThread().interrupt();
- } catch (IOException var7) {
- this.trouble = true;
- }
-
- }
-
- public void print(char[] s) {
- this.write(s);
- }
-
- public void print(char c) {
- this.write(String.valueOf(c));
- }
-
- public void print(double d) {
- this.write(String.valueOf(d));
- }
-
- public void print(float f) {
- this.write(String.valueOf(f));
- }
-
- public void print(int i) {
- this.write(String.valueOf(i));
- }
-
- public void print(long l) {
- this.write(String.valueOf(l));
- }
-
- public void print(Object obj) {
- this.write(String.valueOf(obj));
- }
-
- public void print(String s) {
- if (s == null) {
- s = "null";
- }
-
- this.write(s);
- }
-
- public void print(boolean b) {
- this.write(b ? "true" : "false");
- }
-
- public void println() {
- synchronized(super.lock){}
-
- try {
- this.newLine();
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
-
- public void println(char[] x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(char x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(double x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var5) {
- throw var5;
- }
-
- }
-
- public void println(float x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(int x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(long x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var5) {
- throw var5;
- }
-
- }
-
- public void println(Object x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(String x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void println(boolean x) {
- synchronized(super.lock){}
-
- try {
- this.print(x);
- this.newLine();
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- protected void setError() {
- this.trouble = true;
- }
-
- public void write(char[] buf) {
- this.write((char[])buf, 0, buf.length);
- }
-
- public void write(char[] buf, int off, int len) {
- try {
- synchronized(super.lock){}
-
- try {
- this.ensureOpen();
- this.out.write(buf, off, len);
- } catch (Throwable var8) {
- throw var8;
- }
- } catch (InterruptedIOException var9) {
- Thread.currentThread().interrupt();
- } catch (IOException var10) {
- this.trouble = true;
- }
-
- }
-
- public void write(int c) {
- try {
- synchronized(super.lock){}
-
- try {
- this.ensureOpen();
- this.out.write(c);
- } catch (Throwable var6) {
- throw var6;
- }
- } catch (InterruptedIOException var7) {
- Thread.currentThread().interrupt();
- } catch (IOException var8) {
- this.trouble = true;
- }
-
- }
-
- public void write(String s) {
- this.write((String)s, 0, s.length());
- }
-
- public void write(String s, int off, int len) {
- try {
- synchronized(super.lock){}
-
- try {
- this.ensureOpen();
- this.out.write(s, off, len);
- } catch (Throwable var8) {
- throw var8;
- }
- } catch (InterruptedIOException var9) {
- Thread.currentThread().interrupt();
- } catch (IOException var10) {
- this.trouble = true;
- }
-
- }
- }
-